home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / dot_scripts.lua < prev    next >
Encoding:
Text File  |  2004-11-22  |  5.1 KB  |  161 lines

  1. function magic_burst(unit)
  2.     local magic = {}
  3.     local magic_ps = {}
  4.     magic[0] = unit:addSimpleEffect(ENET_EFFECT_DUMMY)
  5.     magic[0]:setLocalPosition(0,20,0)
  6.     magic[0]:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI * 2)
  7.     magic_ps[0] = magic[0]:addSimpleEffect(ENET_EFFECT_PS_EFFECTMORDASHOT1)
  8.     magic_ps[0]:setLocalPosition(20,0,0)
  9.  
  10.     magic[1] = unit:addSimpleEffect(ENET_EFFECT_DUMMY)
  11.     magic[1]:setLocalPosition(0,20,0)
  12.     magic[1]:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,-MATH_PI * 2)
  13.     magic_ps[1] = magic[1]:addSimpleEffect(ENET_EFFECT_PS_EFFECTMORDASHOT1)
  14.     magic_ps[1]:setLocalPosition(20,0,0)
  15.  
  16.     pause(2.8)
  17.     magic_ps[0]:suspend()
  18.     magic_ps[1]:suspend()
  19.     magic[0]:suspendedDestroy(2.0)
  20.     magic[1]:suspendedDestroy(2.0)
  21. end
  22.  
  23. -- scripts for unit section
  24. function units_dot_setup()
  25.     units_setup(4,false,ENET_EFFECT_PS_SETUPSMOKE_SMALL,ENET_EFFECT_GEOMETRY_DOTSHADOW)
  26. end
  27.  
  28. function units_dot_resetup()
  29.     units_setup(4,false,nil,ENET_EFFECT_GEOMETRY_DOTSHADOW)
  30. end
  31.  
  32. function units_dot_select()
  33.     units_select(12,2)
  34. end
  35.  
  36. function units_dot_unselect()
  37.     units_unselect()
  38. end
  39.  
  40. function units_dot_selectenemy()
  41.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  42. end
  43.  
  44. function units_dot_damaged()
  45.     uniGetExecutor():applyDamage(uniGetLife())
  46. end
  47.  
  48. function units_dot_highlight()
  49.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  50. end
  51.  
  52. function units_dot_explode()
  53.     units_explode_small1()
  54. end
  55.  
  56. function units_dot_fire()
  57.     local unit = uniGetExecutor()
  58.     local gt = unit:getBone(ENBT_GUNTOWER)
  59.     local sound = gt:play3DSound("pillbox rotate.wav",1)
  60.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  61.     sound:destroy()
  62.     local firespot = gt:getBone(ENBT_FIRE1)
  63.     waitDeath(gt:aimGun(0,MATH_PI / 3.0,uniGetTarget()))
  64.  
  65.     local i = 0
  66.     for i = 0,0 do
  67.         gt:play3DSound("pillbox fire2.wav",0)
  68.         local shot1 = firespot:addSimpleEffect(ENET_EFFECT_DOTSHOT_FLY)
  69.         local shot2 = firespot:addBulletEffect(ENET_EFFECT_PS_DOTSHOT)
  70.         shot1:executeCommand(ENC_FIRE1)
  71.         shot2:suspendedDestroy(1.5)
  72.         gt:gunRecoil(0,0.3,8)
  73.     end
  74.     pause(1.25)
  75.     unit:addFireArrow()
  76. end
  77.  
  78. function units_dot_move()
  79. end
  80.  
  81. -- register unit section
  82. registerCommand(ENSCRIPTSET_DOT,ENC_MOVE,"units_dot_move")
  83. registerCommand(ENSCRIPTSET_DOT,ENC_FIRE1,"units_dot_fire")
  84. registerCommand(ENSCRIPTSET_DOT,ENC_FIRE2,"units_dot_fire")
  85. registerCommand(ENSCRIPTSET_DOT,ENC_SELECT,"units_dot_select")
  86. registerCommand(ENSCRIPTSET_DOT,ENC_SELECTENEMY,"units_dot_selectenemy")
  87. registerCommand(ENSCRIPTSET_DOT,ENC_UNSELECT,"units_dot_unselect")
  88. registerCommand(ENSCRIPTSET_DOT,ENC_SETUP,"units_dot_setup")
  89. registerCommand(ENSCRIPTSET_DOT,ENC_RESETUP,"units_dot_resetup")
  90. registerCommand(ENSCRIPTSET_DOT,ENC_DAMAGED,"units_dot_damaged")
  91. registerCommand(ENSCRIPTSET_DOT,ENC_EXPLODE,"units_dot_explode")
  92. registerCommand(ENSCRIPTSET_DOT,ENC_HIGHLIGHT,"units_dot_highlight")
  93.  
  94. -- make description of unit
  95. desc = getEffectDescriptionP(ENET_UNIT_DOT)
  96. desc.ClassID = ENCLASS_MESHINSTANCE
  97. desc.EffectClassType = ENECT_GEOMETRY
  98. desc.FileName = "dot.rmd"
  99. desc.ScriptSet = ENSCRIPTSET_DOT
  100. desc.MoveType = ENMOVE_NOTALLOWED
  101. desc.RenderType = ENRENDERTYPE_GEOMETRY
  102. desc.Material = ENMAT_RIGIDSKINNEDMESH
  103. desc.MaterialColors = units_materialcolors_human
  104.  
  105. -- shadow
  106. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_DOTSHADOW)
  107. desc.ClassID = ENCLASS_MESHINSTANCE
  108. desc.EffectClassType = ENECT_GEOMETRY
  109. desc.FileName = "dot_shadow.rmd"
  110. desc.RenderType = ENRENDERTYPE_SHADOW
  111. desc.Material = ENMAT_SHADOW
  112. desc.MaterialColors = units_materialcolors_shadow
  113.  
  114. --------------------------------------------------------------------------------------
  115. --------------------------------------------------------------------------------------
  116. --------------------------------------------------------------------------------------
  117. --[[
  118. -- "breathing" dot
  119. interpolator = createInterpolator()
  120. interpolator:addKey(0.0,0.9)
  121. interpolator:addKey(2.0,1.1)
  122. interpolator:addKey(4.0,0.9)
  123. interpolator:finalize(true)
  124. -- add interpolator on X scale
  125. desc:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_X))
  126. -- add interpolator on Y scale
  127. desc:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_Y))
  128. -- add interpolator on Z scale
  129. desc:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_Z))
  130. changeEffect(ENET_UNIT_DOT,desc)
  131. ]]--
  132.  
  133. -- register new unit to logic
  134. unitDesc = logic_getUnitDescP(26)
  135. unitDesc.group = 2
  136. unitDesc.order = 0
  137. unitDesc.unit_res_id = ENET_UNIT_DOT
  138. unitDesc.unit_icon_id = "Dot_h_small_normal.dds"
  139. unitDesc.active_id = "Dot_h_small_active.dds"
  140. unitDesc.pressed_id = "Dot_h_small_pressed.dds"
  141. unitDesc.small_icon_id = "Dot_u_stats.dds"
  142. unitDesc.big_icon_id = "Dot_h_big_normal.dds"
  143. unitDesc.HP = 4
  144. unitDesc.MP = 0
  145. unitDesc.WR = 2
  146. unitDesc.min_WR = 1
  147. unitDesc.WD = 1
  148. unitDesc.WR2 = 0
  149. unitDesc.min_WR2 = 0
  150. unitDesc.WD2 = 0
  151. unitDesc.ability = 1
  152. unitDesc.transport = 0
  153. unitDesc.value = 1
  154. unitDesc.race = 0
  155. unitDesc.fire_pause = 0.6
  156. unitDesc.move_pause = 0.5
  157. unitDesc.unit_info_scale = 0.07
  158. unitDesc.scn_name = "PILLBOX"
  159.  
  160.  
  161.